#ifndef THREADPEERSCONECTAR_H_
#define THREADPEERSCONECTAR_H_
#include <list>
#include <queue>
#include "Condition.h"
#include "Mutex.h"
#include "InterfazPeer.h"
#include "RespuestaTracker.h"
#include "ConexionPeerCliente.h"

class Torrent;

class ThreadPeersConectar : public Thread {
private:
	Torrent *torrent;

	unsigned int maxCantPeers;
	Mutex mutexMaxCantPeers;

	void conectarPeer(Peer peer);

public:
	ThreadPeersConectar(Torrent *torrent, unsigned int maxCantPeers = 50);
	virtual ~ThreadPeersConectar();
	virtual void* run();
	virtual void stop();

	void setMaxCantPeers(unsigned int maxCantPeers);
	unsigned int getMaxCantPeers();

};

#endif /* THREADPEERSCONECTAR_H_ */
